/////////////////////////
// 	DDScroll.h	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.2
//	v0010		:	Dec.24.1996
/////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CDDScrollBar class
#ifndef __DDSCROLL_H__
#define __DDSCROLL_H__

#include	"stdafx.h"
#include	"DDapi.h"
#include	"DDButton.h"
#include	"DDBitmap.h"
#include	"Marco.h"

/////////////////////////////////////////
// to test whether a Scroll-bar is clicked  --- WM_LcheckboxDOWN
/////////////////////////////////////////
BOOL	LeftButtonDownOnScrollBar(int xPos, int yPos);
/////////////////////////////////////////
//	to delete all bitmap of list when you exit this game
void	FACE_DeleteAllScrollBar(void) ;
/////////////////////////////////////////
//	to blit all bitmap of list. This function is just for the class CDDMenu
void	FACE_BlitAllScrollBar(void) ;
/////////////////////////////////////////
class	CDDScrollBar
{
//data member
private:
// the surface that this scroll-bar is load on
	class	CDDSurface	m_BitmapSurface;
public:
	class	CDDBitmap	m_BitmapScrollBlock;
	class	CDDButton	m_nLeftArrow;
	class	CDDButton	m_nRightArrow;
// data member
public:
	int		m_nCurrentPart;		// the percent of this scroll-bar
	int		m_nTotalPart;		// how many part was this scroll-bar divided
	int		m_dwX, m_dwY;	// the position of a bitmap scroll-bar on the surface
	SIZE	m_szOneBitmap;	// the size of one state of a bitmap scroll-bar
// Attributes
private:
	int		m_nFileNameId;	// name of this DIB file name
	RECT	m_rTotal;		// there is four state of a bitmap scroll-bar in a DIB file	
	RECT	m_rCurrent;		// the rectangle of current state bitmap scroll-bar

	int  m_nID;		// scroll-bar id
	int  m_nState;	// scroll-bar state,0-up,1-down,2-disable,3-focus
//member function
public:
	// construct
	CDDScrollBar();
	// disconstruct
	~CDDScrollBar();

	BOOL	PreLoad(int FilenameId, int x, int y,
						int OneBitmapWidth=0, int OneBitmapHeight=0);
	// to release the bitmap surface
	void	Release(void);
	// to set how many part was this scroll-bar divided
	void	SetTotalPart(int part){m_nTotalPart = part;}
	// to get how many part was this scroll-bar divided
	int		GetTotalPart(void){return m_nTotalPart;};
	// to set the current part of this scroll bar
	void	SetCurrentPart(int part);
	// to get the current part value of this scroll bar
	int		GetCurrentPart(void);
	// to set the id of this scroll bar
	void	SetID(int ID);
	// to set the state of this scroll bar
	void	SetState( int state = -1 );
	// to get the state of this scroll bar
	int		GetState(void);
	// to get the size of this scroll bar
	SIZE	GetSize(void){return m_szOneBitmap;}
	// to judge if the mouse is on this scroll bar
	BOOL	OnScrollBar( int x, int y);
	// to show this scroll bar
	void	Show(int flag = 0);	//if flag=FIRST -->to show this scroll-bar first time
								//if flag=0		-->to show the middle-bar only
	// to blit this scrollbar to back buffer
	void	Blit(int flag = 0); //if flag=FIRST -->to blit this scroll-bar first time
								 //if flag=0	-->to blit the middle-bar only
	// to update the area of this scrollbar stay
	void	Update(int flag = 0);	//if flag=FIRST -->to update this scroll-bar first time
									//if flag=0		-->to update the middle-bar only
};
///////////////////////////////////
#endif

